<?php
$item_name = strlen($dcommittee['Committee']['item_name'])>2 ? $dcommittee['Committee']['item_name'] : __('Project',true);
$dcommitteeName = $dcommittee['Committee']['short_name'];

if (isset($attachment)) {
	$total_attachment = count($attachment);
}

if(isset($javascript)):
// load script in <head> section
$javascript->link('scriptaculous/lib/prototype', false);
$javascript->link('scriptaculous/src/scriptaculous', false);
$javascript->link('modalbox/modalbox', false);
echo $html->css('modalbox');
endif;
if(isset($javascript)):
?>
<script language="javascript" type="text/javascript">
<?php $options = '
            mode : "exact",     
            elements : "DecisionDesc'.$node.'",
            theme : "advanced",
            theme_advanced_buttons1 : "bold,italic,underline,|,undo,redo,|,cut,copy,paste,|,bullist,numlist,outdent,indent,|,sub,sup,",
            theme_advanced_buttons2 : "",
            theme_advanced_buttons3 : "",
            theme_advanced_toolbar_location : "top",
            theme_advanced_toolbar_align : "left",
            extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|color|style],span[class|align|style]"
    ';
?>
tinyMCE.init({<?php echo($options); ?>});
</script> 

<?php
endif;
?>
<div id="processing_<?php echo $node;?>" style="display:none" >
    <br><strong>Data Processing...</strong>
</div>
<div class="minute_form" id="minute_form<?php echo $node;?>">
    
    <?php echo $this->element('minutes/decision_links',array('node'=>$node,'meetingid'=>$meetingid,'id'=>$id));?>
    <div id="close_button_<?php echo $node;?>" class="button close"  style='display:none;cursor:pointer;' onclick="Element.hide('close_button_<?php echo $node;?>');Effect.Fade('formbox_<?php echo $node;?>');Element.show('links_<?php echo $node;?>');">
        <?php __('X')?>
    </div>
    <div id="formbox_<?php echo $node;?>" class='formbox' style='display:none'>
        <div id="dec_form_<?php echo $node;?>" class='form'>
            <h2><?php __('New item')?></h2>
            <div>
                <form name="regform">

                    <?php
                        echo $form->hidden('meeting_id',array('value'=>$meetingid));
                        echo $form->hidden('node',array('value'=>$node));
                        echo $form->hidden('parent_id',array('value'=>$id));
						echo $form->hidden('item_name',array('value'=>$item_name));
                        echo $form->input(ucwords($item_name), array('options' => $items, 'value'=>$this->data['Decision']['item_id']));
                        echo $form->input('description',array('class'=>'info','type'=>'textarea','cols'=>'14','rows'=>'5','id'=>'DecisionDesc'.$node,'value'=>$this->data['Decision']['description'])); 
						
                        echo $multiFile->input('additionalfiles',array('label'=>'Additional Files'));
                        /*if ( count($attachment) > 0 ) {
							foreach ( $attachment as $attachments) {
								echo "<div id='att".$attachments['id']."' ><a href='../../../".$attachments['file']."'>".$attachments['filename']."</a>&nbsp;<input type='button' value='Delete' onClick=\"filedel('".$attachments['id']."','".$dcommitteeName."' );\"/></div>";
							}
						}*/
                        echo $datePicker->picker('deadline',array('name'=>'data[Decision][deadline]','value'=>(!empty($this->data['Decision']['deadline']) && $this->data['Decision']['deadline']!='0000-00-00')?date('Y-m-d',strtotime($this->data['Decision']['deadline'])):'','label'=>__('Decision deadline',true)));
                        echo $datePicker->picker('status_deadline',array('name'=>'data[Decision][status_deadline]','label'=>__('Update status deadline',true),'value'=>(!empty($this->data['Decision']['status_deadline']) && $this->data['Decision']['status_deadline']!='0000-00-00')?date('Y-m-d',strtotime($this->data['Decision']['status_deadline'])):'')); 
                        echo '<div class="fieldset-inside">';
                        echo $this->element('decisionusergrouplist',array('users'=>$users,'groups'=>$groups));
                        echo '</div>'
                    ?>
                    <button style="
                            background:#C0C0C0 none repeat scroll 0 0;
                            border:1px solid #808080;
                            color:#204B85;
                            display:inline;
                            font-size:100%;
                            font-weight:bold;
                            margin:10px 0 0;
                            padding:2px 5px;
                            vertical-align:bottom;
                            width:auto;"    
                        onClick="beforeSubmit(this.form,'<?php echo $node; ?>','<?php echo $dcommitteeName; ?>', 'editDecision')" 
                        type="button"><?php __('Save')?></button>
                </form>
            </div>
        </div>
        <div id="upload_<?php echo $node;?>" class="recebe">&nbsp;</div>
        <div class="implementorlist" id="impl_list_<?php echo $node;?>" style="display:none;"></div>
    </div>
</div>

